﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;

using AloneLibrary.Services.Camera;
using XNAnimation;
using XNAnimation.Controllers;
using XNAnimation.Effects;

namespace AloneLibrary.GameObjects
{

    public class GameObject
    {
		protected Model model;
		protected Effect effect;
		protected Matrix world = Matrix.Identity;
        protected BoundingSphere boundingSphere;
        protected BoundingBox boundingBox;
		public Vector3 Position = Vector3.Zero;
		public Vector2 Rotation = Vector2.Zero;
		public float Scale = 1f;
		public bool Available = false;
        private bool enabled = true;

        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="GameObject"/> is enabled.
        /// </summary>
        /// <value><c>true</c> if enabled; otherwise, <c>false</c>.</value>
        public bool Enabled
        {
            get { return enabled; }
            set { enabled = value; }
        }

        /// <summary>
        /// Gets the bounding sphere.
        /// </summary>
        /// <value>The bounding sphere.</value>
        public BoundingSphere BoundingSphere {
            get { return this.boundingSphere; }
        }

        /// <summary>
        /// Gets the bounding box.
        /// </summary>
        /// <value>The bounding box.</value>
        public BoundingBox BoundingBox {
            get { return this.boundingBox; }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="GameObject"/> class.
        /// </summary>
        /// <param name="model">The model.</param>
        public GameObject(Model model, Effect effect)
        {
            this.Model = model;
            this.effect = effect;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="GameObject"/> class.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="position">The position.</param>
        /// <param name="direction">The direction.</param>
        /// <param name="scale">The scale.</param>
		public GameObject(Model model, Effect effect, Vector3 position, Vector2 rotation, float scale)
		{
			this.model = model;
			this.effect = effect;
			
			this.Position = position;
			this.Rotation = rotation;
			this.Scale = scale;
			this.Available = false;
		}


        /// <summary>
        /// Gets or sets the world.
        /// </summary>
        /// <value>The world.</value>
        public Matrix World
        {
            get { return world; }
            set { world = value; }
        }

        /// <summary>
        /// Gets or sets the model.
        /// </summary>
        /// <value>The model.</value>
		public Model Model
		{
			get { return model; }
			set { model = value; }
		}

        /// <summary>
        /// Draws the specified game time.
        /// </summary>
        /// <param name="gameTime">The game time.</param>
        /// <param name="camera">The camera.</param>
        public virtual void Draw(GameTime gameTime, ICameraHandler camera)
        {
        }
	}
}